import {
    DIC
} from '@/const/dic';
import {
    parseTime
} from '../formatter';
import Store from '../../store/';
const isAdmin = Store.state.user.userInfo.superAdmin;
const allPermission = Store.state.user.permission;
export const adminTableOption = {
    border: true,
    index: true,
    selection: true,
    calcHeight: 350,
    menu: true,
    menuAlign: "center",
    searchBtn: true,
    labelWidth: 120,
    searchClearable: false,
    tip: false,
    selectClearBtn: false,
    clearable: false,
    searchResetBtn: false,
    refreshBtn: true,
    addBtn: true,
    dialogWidth: '800px',
    height: "auto",
    dialogHeight: 'auto',
    menuWidth: 320,
    editBtn: isAdmin || !!allPermission['/admin/manager/modify'],
    viewBtn: false,
    delBtn: isAdmin || !!allPermission['/admin/manager/delete'],
    column: [{
            "label": "账号",
            "prop": "loginName",
            "search": true,
            editDisabled: true,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": true,
                "message": "请输入账号",
                "trigger": "blur"
            }]
        },
        {
            "label": "密码",
            "prop": "password",
            "search": false,
            addDisplay:true,
            editDisplay:false,
            "type": "password",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            hide:true,
            // "display": false,
            "rules": [{
                "required": true,
                "message": "请输入密码",
                "trigger": "blur"
            }]
        },
        {
            "label": "姓名",
            "prop": "name",
            "search": true,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": true,
                "message": "请输入姓名",
                "trigger": "blur"
            }]
        },
        {
            "label": "角色",
            "prop": "roleId",
            "search": false,
            "type": "select",
            "fixed": false,
            placeholder: '请选择角色',
            "width": "auto",
            props: {
                label: 'label',
                value: 'value'
            },
            dicUrl: '/admin/role/list-all',
            dicMethod: 'post',
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "rules": [{
                "required": true,
                "message": "请选择角色",
                "trigger": "blur"
            }]
        },
        {
            "label": "状态",
            "prop": "status",
            "search": true,
            "type": "tag",
            "fixed": false,
            "width": "auto",
            "minWidth": "120",
            dicData: DIC.STATE,
            "readonly": false,
            "span": 12,
            "display": false
        },

        // {
        //     "label": "最后登录IP",
        //     "prop": "lastLoginIp",
        //     "search": false,
        //     "type": "text",
        //     "fixed": false,
        //     "width": "auto",
        //     "minWidth": "120",
        //     "readonly": false,
        //     "span": 12,
        //     "display": false
        // },
        // {
        //     "label": "最后登录时间",
        //     "prop": "lastLoginTime",
        //     "search": false,
        //     "type": "datetime",
        //     "fixed": false,
        //     "width": "170",
        //     "minWidth": "120",
        //     "readonly": false,
        //     "span": 12,
        //     "display": false
        // },
        {
            "label": "创建时间",
            "prop": "createTime",
            "search": false,
            "type": "datetime",
            "fixed": false,
            "width": "180",
            "readonly": false,
            "span": 12,
            "display": false
        },
        {
            "label": "修改时间",
            "prop": "modifyTime",
            "search": false,
            "type": "datetime",
            "fixed": false,
            "width": "180",
            "readonly": false,
            "span": 12,
            "display": false
        }
    ]
};
